unit uEscolha;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, rpcompobase, rpvclreport, Menus, ShellApi;

type
  TfPrincipal = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn11: TBitBtn;
    Panel2: TPanel;
    BitBtn12: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    BitBtn8: TBitBtn;
    BitBtn10: TBitBtn;
    BitBtn9: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn14: TBitBtn;
    Panel3: TPanel;
    BitBtn4: TBitBtn;
    PopupMenu1: TPopupMenu;
    Sair1: TMenuItem;
    btnFiltroApont: TBitBtn;
    btnTransfLote: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn16: TBitBtn;
    BitBtn18: TBitBtn;
    BitBtn17: TBitBtn;
    BitBtn13: TBitBtn;
    BitBtn15: TBitBtn;
    BitBtn19: TBitBtn;
    BitBtn20: TBitBtn;
    BitBtn21: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn7Click(Sender: TObject);
    procedure BitBtn8Click(Sender: TObject);
    procedure BitBtn9Click(Sender: TObject);
    procedure BitBtn10Click(Sender: TObject);
    procedure BitBtn11Click(Sender: TObject);
    procedure BitBtn12Click(Sender: TObject);
    procedure BitBtn14Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure BitBtn15Click(Sender: TObject);
    procedure btnFiltroApontClick(Sender: TObject);
    procedure btnTransfLoteClick(Sender: TObject);
    procedure BitBtn16Click(Sender: TObject);
    procedure BitBtn17Click(Sender: TObject);
    procedure BitBtn18Click(Sender: TObject);
    procedure BitBtn19Click(Sender: TObject);
    procedure BitBtn20Click(Sender: TObject);
    procedure BitBtn21Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fPrincipal: TfPrincipal;

implementation

uses uDesmOf, uProducao, uEtiqUser, uEtiqSair, uEtiqImprime, udm,
  uMotivoRefugo, uColetorCad, uEtiqReimprime, uConfirmaRec, uApontFiltro,
  uProdTransf, uRefugoApont, uEmpenhadoConsulta, uParametro, uApontProd,
  uOperador, uRefugoRet, uAcomProd, uRel1;

{$R *.dfm}

procedure TfPrincipal.BitBtn1Click(Sender: TObject);
begin
   fOfDesmem := TfOfDesmem.Create(Application);
   try
     fOfDesmem.ShowModal;
   finally
     fOfDesmem.Free;
   end;
end;

procedure TfPrincipal.BitBtn2Click(Sender: TObject);
begin
   fRefugoApont := TfRefugoApont.Create(Application);
   try
     fRefugoApont.ShowModal;
   finally
     fRefugoApont.Free;
   end;
end;

procedure TfPrincipal.BitBtn3Click(Sender: TObject);
begin
   fEtiqUser := TfEtiqUser.Create(Application);
   try
     fEtiqUser.ShowModal;
   finally
     fEtiqUser.Free;
   end;
end;

procedure TfPrincipal.BitBtn4Click(Sender: TObject);
begin
   fEtiqSair := TfEtiqSair.Create(Application);
   try
     fEtiqSair.ShowModal;
   finally
     fEtiqSair.Free;
   end;

end;

procedure TfPrincipal.BitBtn5Click(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TfPrincipal.BitBtn6Click(Sender: TObject);
begin
  fEtiqImprime.Showmodal;
end;

procedure TfPrincipal.BitBtn7Click(Sender: TObject);
var rep1: TVCLReport;
begin
  rep1 := TVCLReport.Create(nil);
  rep1.PrinterSetup;
  rep1.FileName := 'lista_erros.rep';
  rep1.Report.DatabaseInfo.Items[0].SQLConnection := dm.SQLConnection1;
  Rep1.Title := Rep1.FileName;
  Rep1.Execute;
  Rep1.Destroy;
end;

procedure TfPrincipal.BitBtn8Click(Sender: TObject);
begin
  fMotivoRefugo.Showmodal;
end;

procedure TfPrincipal.BitBtn9Click(Sender: TObject);
var rep1: TVCLReport;
begin
  rep1 := TVCLReport.Create(nil);
  rep1.PrinterSetup;
  rep1.FileName := 'manual_apontamento.rep';
  rep1.Report.DatabaseInfo.Items[0].SQLConnection := dm.SQLConnection1;
  Rep1.Title := Rep1.FileName;
  Rep1.Execute;
  Rep1.Destroy;
end;

procedure TfPrincipal.BitBtn10Click(Sender: TObject);
var rep1: TVCLReport;
begin
  rep1 := TVCLReport.Create(nil);
  rep1.PrinterSetup;
  rep1.FileName := 'manual_apontamentoCompleto.rep';
  rep1.Report.DatabaseInfo.Items[0].SQLConnection := dm.SQLConnection1;
  Rep1.Title := Rep1.FileName;
  Rep1.Execute;
  Rep1.Destroy;
end;

procedure TfPrincipal.BitBtn11Click(Sender: TObject);
begin
  fColetorCad.showModal;
end;

procedure TfPrincipal.BitBtn12Click(Sender: TObject);
begin
  if (Panel3.Visible) then
  begin
    Panel2.Visible := True;
    Panel3.Visible := False;
  end
  else begin
    Panel3.Visible := True;
    Panel2.Visible := False;
  end;
end;

procedure TfPrincipal.BitBtn14Click(Sender: TObject);
begin
  fEtiqReImprime.Showmodal;
end;

procedure TfPrincipal.FormShow(Sender: TObject);
begin
  Panel2.Visible := False;
end;

procedure TfPrincipal.BitBtn15Click(Sender: TObject);
begin
  fRefugoRet.ShowModal;  
end;

procedure TfPrincipal.btnFiltroApontClick(Sender: TObject);
begin
  //fApontFiltro.showModal;
  fApontProd.showModal;
end;

procedure TfPrincipal.btnTransfLoteClick(Sender: TObject);
begin
  fTransfProduto.showModal;
end;

procedure TfPrincipal.BitBtn16Click(Sender: TObject);
begin
  fEmpenhoConsulta.showModal;
end;

procedure TfPrincipal.BitBtn17Click(Sender: TObject);
var dir: String;
begin
  dir := ExtractFilePath(Application.ExeName);
  ShellExecute(Handle, 'open', PChar(dir + 'Coletor.exe'), nil, nil, SW_SHOWNORMAL) ;
end;

procedure TfPrincipal.BitBtn18Click(Sender: TObject);
var dir1: String;
begin
  dir1 := ExtractFilePath(Application.ExeName);
  ShellExecute(Handle, 'open', PChar(dir1 + 'PesqRastri.exe'), nil, nil, SW_SHOWNORMAL) ;
end;

procedure TfPrincipal.BitBtn19Click(Sender: TObject);
begin
  fOperador.showModal;
end;

procedure TfPrincipal.BitBtn20Click(Sender: TObject);
begin
  //fAcomProd.ShowModal;
  fRel1.ShowModal;
end;

procedure TfPrincipal.BitBtn21Click(Sender: TObject);
begin
  fAcomProd.ShowModal;
end;

end.
